Toolbox

Online Scheduling, Jeff Smith’s SQL Blog, Easy Regular Expressions, And More

Scott Mitchell

All prices were confirmed September 18, 2008, and are subject to change. The opinions expressed in this column are solely those of the author and do not necessarily reflect the opinions at Microsoft.

Contents

Create an Online Calendar and Scheduling Interface
Blogs of Note
Your Own Regular Expression Assistant
The Bookshelf

Create an Online Calendar and Scheduling Interface

Many business applications require users to be able to easily assign assets to resources for a particular date and time. For example, the software that powers a doctor's office needs to schedule assets such as doctors, patients, and equipment to resources such as offices and rooms. And a time sheet application associates employees' time and activities with projects and meetings.

Although ASP.NET includes a Calendar Web control, it lacks the features and functionality needed for a robust scheduling user interface. The good news is that implementing a professional-looking and feature-rich scheduling experience is a walk in the park with DayPilot 4.8 by Dan Letecky. DayPilot is a collection of Web controls that display AJAX-enabled calendar and scheduling user interfaces. Out of the box, DayPilot lets you view the schedule for a particular asset using month, week, or day views. These user interfaces mirror those found in desktop-based scheduling applications, such as the calendar in Microsoft Outlook.

There is also a scheduler view, which lists resources along the left column and dates and times across the top. This view makes it easy to see how the resources are allocated and to spot conflicts and available resources.

The information displayed in the DayPilot controls can be specified in a number of ways. You can programmatically supply this information as an array; if the data resides in an XML file or database, you can use a data source control or programmatically bind the data. Once the data is displayed, you can customize the appearance using a variety of properties. What's more, there are many events and extension points, making it easy to customize the display and behavior of these controls. For example, it takes just a few lines of code to instruct DayPilot to use different background colors for an event based on the asset or resource.

The most exciting aspect of DayPilot is its integrated AJAX support. The DayPilot user interfaces let the end user drag and drop scheduled events and to modify event durations and information by clicking, dragging, and double-clicking. There is also an integrated context menu, which is displayed when the user right-clicks on an existing scheduled event. The context menu can be used to modify the selected event, delete it, or perform some custom action.

At the time of this writing, DayPilot has been thoroughly tested with Internet Explorer 6.0 and up and Firefox 2.0 and up. The development roadmap includes upcoming support for both the Safari and Opera browsers.

DayPilot is available in two editions: an open-source version, which is free, and a Pro version. In a nutshell, the open-source version provides read-only day and week views. To enjoy the month and scheduler views and to allow your users to move and edit events from the DayPilot user interfaces, you will need to use the Pro version.

Price: Free open-source version; $549 for the Pro version.

daypilot.org/daypilot-pro-4-8.htm

daypilotfpo.gif

DayPilot Makes Implementing a Feature-Rich Scheduling Experience Simple
(Click the image for a larger view)

Blogs of Note

Most application developers have a working knowledge of SQL, the query language used to retrieve and modify information from a database. They know how to perform the most common tasks performed by data-driven applications—selecting data, filtering and ordering the results, and updating, deleting, and inserting records—but they get stuck when faced with a data-related challenge that falls outside the ordinary. To help boost your SQL skills, check out Jeff Smith's blog. Jeff is a .NET developer who's got a knack for SQL. He posts an assortment of tips and tricks every week, along with articles and guidance on database design.

Jeff's blog entries explore topics such as what the ALL keyword does in the GROUP BY statement; how left and right outer joins differ and whether one is better than the other; how to retrieve the top n percent per group; and how to best choose column data types when designing your database. And each blog entry is written in a down-to-earth style that is easy to read and understand.

Do you have a particularly tricky query that's got you stumped? Send in your question to Jeff. Don't worry, you won't be imposing, as Jeff encourages his readers to e-mail him their SQL-related questions. These questions and their answers are then posted to Jeff's blog so that everyone benefits. Even if you don't have a question (or are too shy to ask one), you can still learn a lot by reading other people's questions and Jeff's solutions.

weblogs.sqlteam.com/jeffs

Your Own Regular Expression Assistant

Regular expressions are a terse syntax for matching string patterns and are an ideal way to search for or replace strings in a body of text. They are commonly used in validating user inputs that must conform to a particular pattern (telephone numbers, e-mail addresses, and so on) and in advanced search and replace scenarios.

Short and simple regular expressions are usually easy to write and read, but longer and more complex ones can be notoriously difficult to craft. A lengthy regular expression, with its conglomeration of literal characters, special symbols, groups, captures, and lookaround functionality, can quickly morph into an unintelligible blob of characters. For help creating, parsing, testing, and debugging regular expressions, check out RegexBuddy 3.1.1 by Just Great Software.

With its Insert Token toolbar, RegexBuddy makes creating a regular expression as simple as point and click. Choose what tokens to add to your regular expression: literal text; character classes such as digits, white space, or alphabetic characters; capturing or non-capturing groups; back references; and so forth. RegexBuddy shows the regular expression as text and as a tree of tokens. Adding a new token from the Insert Token toolbar adds the appropriate token to the tree and updates the regular expression. Selecting a token from the tree highlights the corresponding characters in the regular expression and vice versa.

This token tree view is very helpful in understanding an existing unwieldy regular expression. Paste the regular expression into RegexBuddy and the token tree is automatically loaded, explaining the behavior of each token in the regular expression step by step.

RegexBuddy provides tools for testing and debugging your regular expressions. After creating or entering your regular expression, go to the Test tab to try it out. You can manually type in a body of text or load it from a file or URL. Matching patterns in the body of text are automatically highlighted. From the Debug tab, you can examine how the parser evaluates the body of text against the regular expression.

RegexBuddy can also serve as a repository for your regular expressions. There is a Library tab where you can save your regular expressions. The Library also contains a variety of regular expressions for performing common tasks such as HTML and XML processing, and numeric and date string processing. RegexBuddy will even write the Visual Basic or C# code needed to use regular expressions from within your applications. Choose the language and action to perform—finding regular expression matches in a body of text, replacing matched regular expressions with another string, and so on—and RegexBuddy displays the corresponding source code.

Price: $39.95.

Regexbuddy.com

regexbuddy.gif

RegexBuddy Shows Regular Expressions as Text and as a Tree of Tokens
(Click the image for a larger view)

The Bookshelf

In The Productive Programmer (O'Reilly, 2008), Neal Ford shares proven techniques that will help any developer improve his or her productivity. The first part of the book explores behaviors and tools for boosting developer productivity; the second part looks at software development practices that help contribute to a more streamlined development process.

Early on, Ford focuses on the mechanics of using a computer productively. He provides tips and tools to decrease the amount of time required to perform common programming-related tasks. He espouses the Don't Repeat Yourself tenet for improving productivity and provides examples of how to avoid needless repetition in areas from version control to technical documentation.

Poor software development practices can quickly swallow up those productivity gains, Neal notes. Adding unnecessary features, insufficiently testing your code, and failing to correctly encapsulate your objects are all practices that lead to bugs and unmaintainable code.

The willingness to question the status quo is another important aspect in developer productivity. Too often developers get into a rut and use a particular design pattern or coding technique because that's the way it's always been done, overlooking or turning down alternatives that may be more efficient.

The Productive Programmer contains numerous code examples and discussions on particular frameworks that, unfortunately for .NET developers, focus on Java and Ruby. And although some of the tools mentioned are for UNIX-based or Mac OS systems, the majority of the ideas presented are not architecture, framework, or programming language dependent and will help any programmer build software applications better and faster.

Price: $39.99.

oreilly.com

prodprog.gif

Scott Mitchell, author of numerous books and founder of 4GuysFromRolla.com, is an MVP who has been working with Microsoft Web technologies since 1998. Scott is an independent consultant, trainer, and writer. Reach him at Mitchell@4guysfromrolla.com or via his blog at ScottOnWriting.NET.